﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace MINERP.DAL.Statistics
{
    public class ProceShopProductCountDAL : DALBase
    {
        public DataSet GetShopCount(string inAreas,DateTime inStartTime,DateTime inEndTime)
        {
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("ProceShopProductCount");
            db.AddInParameter(dbCommand, "@Area", DbType.String, inAreas);
            db.AddInParameter(dbCommand, "@StartTime", DbType.DateTime, inStartTime);
            db.AddInParameter(dbCommand, "@EndTime", DbType.DateTime, inEndTime);
            DataSet set = db.ExecuteDataSet(dbCommand);
            return set;
        }
        public List<string> GetAllAreas()
        {
            return DataEntites.Shop.OrderBy(p=>p.Area).Select(p => p.Area).Distinct().ToList();
        }

    }
}
